let time:any;
type FC = (...arg:any) => any;
function debounce (fn:FC, dep = 500):FC {
  return function (...arg) {
    if (time) clearTimeout(time);
    time = setTimeout(() => {
      fn.call(fn, ...arg);
    }, dep);
  };
}
export default debounce;
